package com.fuhaiwei.basic.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BeanFactory {
	private static ApplicationContext applicationContext;

	public static Object getBean(String name) {
		return getContext().getBean(name);
	}

	public static ApplicationContext getContext() {
		if (applicationContext == null) {
			applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
		}
		return applicationContext;
	}
}
